package StudyCode.summary.mycollection;

import java.util.Map;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DeepHashCodeForMap {
	public static <K, V> int deepHashCode(Map.Entry<K, V> entry) {
		return entry.getKey().hashCode() * entry.getValue().hashCode();
	}

	public static <K, V> int deepHashCode(Map<K, V> m) {
		int hashCode = 91;
		for (Map.Entry<K, V> entry : m.entrySet()) {
			hashCode += 13 * deepHashCode(entry);
		}
		return hashCode;
	}
}
